<?php
header('Content-Type: text/plain; charset=utf-8'); 

function auto_translate($from_lan, $to_lan, $text){
	$json = json_decode(file_get_contents('https://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=' . urlencode($text) . '&langpair=' . $from_lan . '|' . $to_lan));
	$translated_text = $json->responseData->translatedText;
	return $translated_text;
}

$input = $_REQUEST['input'];
echo auto_translate("cn","en",$input)."|".auto_translate("cn","vi",$input);

?>

